Folders
Collection Object
The Folders
collection object contains one or more Folder objects.
Quick Info
Specified
in header file: |
MDISP.ODL |
First
available in version: |
OLE
Messaging Library 1.0 |
Parent
objects: |
Folder
(Inbox or Outbox) |
Child
objects: |
Folder |
Default
property: |
Item |
A Folders
collection is considered a large collection, which means that the Count
and Item properties have limited validity, and your best option is to
use a Folder object identifier value or the Get methods to access an
individual Folder object within the collection.
Properties
|
Available
in version |
|
|
Application |
1.0 |
String |
Read-only |
Class |
1.0 |
Long |
Read-only |
Count |
1.1 |
Long |
Read-only |
|
|
|
|
Item |
1.1 |
Folder
object |
Read-only |
Parent |
1.0 |
Inbox or
Outbox folder object |
Read-only |
Session |
1.0 |
Session
object |
Read-only |
Methods
|
Available
in version |
|
Add |
1.1 |
name as
String |
Delete |
1.1 |
(none) |
GetFirst |
1.0 |
(none) |
GetLast |
1.0 |
(none) |
GetNext |
1.0 |
(none) |
GetPrevious |
1.0 |
(none) |
|
|
|
Remarks
Large
collections, such as the Folders collection, cannot always maintain an accurate
count of the number of objects in the collection. It is strongly recommended
that you use the GetFirst
Example
To refer to a
unique Folder object within the Folders collection, use the collection s GetFirst
and GetNext methods or use the FolderID value as the index.
The following
code sample demonstrates the Get methods. The sample assumes that you
have three subfolders within your Inbox and three subfolders within your
Outbox. After this code runs, the three folders in the Inbox are named Blue,
Red, and Orange (in that order), and the three folders in the Outbox are named
Gold, Purple, and Yellow (in that order).
Dim objSession As Object
Dim objMessage As Object
Dim objFolder As Object
Set objSession =
CreateObject("MAPI.Session")
objSession.Logon "User", "",
True
With objSession.Inbox.Folders
Set
objFolder = .GetFirst
objFolder.Name = "Blue"
Set objFolder
= .GetNext
objFolder.Name = "Red"
Set
objFolder = .GetLast
objFolder.Name
= "Orange"
End With
With objSession.Outbox.Folders
Set
objFolder = .GetFirst
objFolder.Name = "Gold"
Set
objFolder = .GetNext
objFolder.Name = "Purple"
Set objFolder = .GetLast
objFolder.Name = "Yellow"
End With
objSession.Logoff
See Also
Object
Collections